<?php
    $this->headTitle($this->site_name.' - Dashboard');
?>
<style>
	.show {display:block;}
	.hide {display:none;}	
</style>

<script type="text/javascript" src="/js/ui/jquery.ui.core.min.js"></script>
<script type="text/javascript" src="/js/ui/jquery.ui.widget.min.js"></script>
<script type="text/javascript" src="/js/ui/jquery.ui.mouse.min.js"></script>
<script type="text/javascript" src="/js/ui/jquery.ui.draggable.min.js"></script>
<script type="text/javascript" src="/js/ui/jquery.ui.droppable.min.js"></script>
<script type="text/javascript" src="/js/ui/jquery.ui.sortable.min.js"></script>

<script>
	function toggle_more(id){
/*		
		if ($("#group_"+id).css('display')=='none'){
			$("#group_"+id).show();
			$("#toggle_"+id).html("- View less");
		}else{
			$("#group_"+id).hide();
			$("#toggle_"+id).html("+ View more services of this group");
		}
*/		

		if ($("#toggle_"+id).html()=="+ View more"){
			$(".group_"+id).removeClass('hide');
			$(".group_"+id).addClass('show');
			$("#toggle_"+id).html("- View less");
		}else{
			$(".group_"+id).removeClass('show');
			$(".group_"+id).addClass('hide');
			$("#toggle_"+id).html("+ View more");
		}
	}
	
</script>


<div id="dashboard">

<h2>Home</h2>
 
<div class="section">
<h3>Welcome to YesUp central account system.</h3>

<div class="demo-frame1" id="droppable1">		

	<ul id="sortable1">
	<li><p>What you can do from your YesUp central account?</p></li>
	<li><p>-  Access all of your services through one account.</p></li>
	<li><p>-  Transfer funds between your subscribed services.</p></li>
	<li><p>-  Centralize  all important messages in one place.</p></li>
	<li><p><a href="/client/" class="grey-btn"><b class="ui-title">Go to my account</b></a></p></li>
	</ul>

</div>
 
</div>


<div class="section">
<div style="margin-left:50px;">
<h3>All YesUp services:</h3>

<div class="demo-frame1" id="droppable2">		

	<ul>
	<?php 
	foreach($this->all_groups as $key => $value ){
		echo '<li style="margin:0;padding:0;"><b>Group '.$value['group_id'].': '.$value['group_name'].'</b></li>';
	
		$group_items=0;
		$more_flag=false;
		foreach($this->all_services as $index => $item ){
			if ($item['group_id']==$value['group_id']){
				$group_items++;
				$group_class = "";
				//if (($group_items>2)and(!$more_flag)){
				if ($group_items>2){
					$more_flag=true;
					$group_class = "group_".$value['group_id']." hide";
					//echo '<div id="group_'.$value['group_id'].'" style="display:none;">';
				}
								
				echo '<li id="'.$item['icon'].'" class="draggable2 '.$group_class.'" style="cursor:pointer;"><div id="'.$item['icon'].'_div"  onclick="window.open(\''.$item['service_url'].'\');"><a href="#">'.$item['dpt_name'].'</a>-<b>'.$item['title'].'</b><span id="'.$item['icon'].'_span"></span><p>'.$item['description'].'.</p></div></li>';
			}
		}
		if ($more_flag){
			//echo '</div><div id="toggle_'.$value['group_id'].'" onclick="toggle_more(\''.$value['group_id'].'\');" style="font-weight:bold;margin:0 0 20px 50px;cursor:pointer;">+ View more services of this group</div>';
			echo '<li id="toggle_'.$value['group_id'].'" onclick="toggle_more(\''.$value['group_id'].'\');" style="font-weight:bold;margin:0;cursor:pointer;">+ View more</li>';
		}
		
	}
	?>
	</ul>

</div>
 </div>
 
</div>


</div>
 
